<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
    <meta name="theme-color" content="#000000">
    <link rel="manifest" href="/manifest.json">
    <link rel="shortcut icon" href="imags/logo.jpg">
    <title>币拍</title>
    <link href="./css/login.css" rel="stylesheet">
</head>
<body>
    <div id="root">
        <div><main class="closed">
            <header class="hero styles-module__header__3OdzN">
                <div class="level is-mobile">
                    <div class="level-left">
                        <div class="control level-item is-hidden-tablet">
                            <button class="button is-primary u-mr1 styles-module__menu_toggle__2MyVZ">
                                <span class="icon-menu"></span>
                            </button>
                        </div>
                        <div class="level-item">
                            <a>
                                <img alt="" class="image styles-module__logo__16ihP" src="imags/logo.jpg"></a>
                        </div>
                        <p style="font-size: 25px">币拍——分享图片，七天得钱</p>
                    </div>
                </div>
            </header>
            <div class="wrapper">
                <aside class="sidebar">
                    <div class="menu p-lg styles-module__menu__1tOsh">
                        <form class="aside-login">
                            <div class="field">
                                <label class="label" for="email">帐号</label>
                                <div class="control ">
                                    <input type="text" name="email" aria-describedby="email" class="input" id="email" required="">
                                </div>
                            </div>
                            <div class="field">
                                <label class="label" for="password">密码</label>
                                <div class="control ">
                                    <input type="password" name="password" aria-describedby="password" class="input" id="password" required="">
                                </div>
                            </div>
                            <div class="modal-cta">
                                <div class="field is-grouped">
                                    <div class="control login-button">
                                        <button class="button is-large is-primary" lay-submit lay-filter="login">
                                            <span>登录</span>
                                        </button>
                                    </div>
                                    <div class="control cancel-button">
                                        <button class="button button is-large is-secondary">
                                            <span>取消</span>
                                        </button>
                                    </div>
                                </div>
                                <div class="col-12 text-center">
                                    <a class="text-link" href="/create-account">注册</a>
                                </div>
                            </div>
                        </form>
                    </div>
                </aside>
                <section class="body closed">
                    <div class="menu-closer" role="button" tabindex="0"></div>
                    <div class="content">
                        <h2 class="title is-2"></h2>
                    </div>
                </section>
            </div>
        </main>
        </div>
    </div>
    <script src="./plugins/layui/layui.js"></script>
    <script src="./js/config.js"></script>
    <script type="text/javascript">
        layui.use(['table','form','element'],function () {
            var $ = layui.$;
            var table = layui.table;
            var form = layui.form;
            var element = layui.element;

            form.on('submit(login)',function(data) {
                console.log(data.field);
                $.ajax({
                    url: contextPath+"/login" ,
                    type: "POST",
                    contentType:"application/json;charset=utf-8",
                    dataType:"json",
                    data: JSON.stringify(data.field) ,
                    success: function(res) {
                        if(res.message == "登录成功！"){
                            window.location.href="assets.html";
                        }else{
                            layer.msg(res.message);
                        }
                    }
                });
                return false;
            });
        });
    </script>
</body>
</html>